/*
  ASCII table

 Prints out byte values in all possible formats:
 * as raw binary values
 * as ASCII-encoded decimal, hex, octal, and binary values

 For more on ASCII, see http://www.asciitable.com and http://en.wikipedia.org/wiki/ASCII

 The circuit:  No external hardware needed.

 created 2006
 by Nicholas Zambetti
 modified 9 Apr 2012
 by Tom Igoe

 This example code is in the public domain.

 <http://www.zambetti.com>

 */
char airArr_[9] = {0xAA, 0x09, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x55};
int frameLen_ = 9;
void setup() {
  char check;
  int i;
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  check = 0;
  for (i = 1; i < frameLen_; i++) {
    check += airArr_[i];
  }
  airArr_[7] = check;
  // prints title with ending line break
  Serial.println("ASCII Table ~ Character Map");
}

// first visible ASCIIcharacter '!' is number 33:
int thisByte = 65;
// you can also write ASCII characters in single quotes.
// for example. '!' is the same as 33, so you could also use this:
//int thisByte = '!';

void loop() {
  int i;
  // prints value unaltered, i.e. the raw binary version of the
  // byte. The serial monitor interprets all bytes as
  // ASCII, so 33, the first number,  will show up as '!'
  Serial.write(thisByte);
  // if printed last visible character '~' or 126, stop:
  if (thisByte == 90) {    // you could also use if (thisByte == '~') {
    // This loop loops forever and does nothing
    thisByte = 64;
    Serial.println(" ");
    delay(5000);
    for (i = 0; i < frameLen_; i++) {
      Serial.write(airArr_[i]);
    }
    delay(5000);
    Serial.println(" ");
  }
  // go on to the next character
  thisByte++;
}
